"use strict";
return new Promise((_resolve, _reject) => {
    var _sync = true;
    var _context;
    var _x = this._x;
    var _fn0 = _x[0];
    var _hasResult0 = false;
    _fn0(source, target, routesList).then(_result0 => {
        _hasResult0 = true;
        if (_result0 !== undefined) {
            source = _result0;
        }
        var _fn1 = _x[1];
        var _hasResult1 = false;
        _fn1(source, target, routesList).then(_result1 => {
            _hasResult1 = true;
            if (_result1 !== undefined) {
                source = _result1;
            }
            _resolve(source);
        }, _err1 => {
            if (_hasResult1) throw _err1;
            if (_sync)
                _resolve(Promise.resolve().then(() => {
                    throw _err1;
                }));
            else
                _reject(_err1);
        });
    }, _err0 => {
        if (_hasResult0) throw _err0;
        if (_sync)
            _resolve(Promise.resolve().then(() => {
                throw _err0;
            }));
        else
            _reject(_err0);
    });
    _sync = false;
});
}